<template>
    <Table :columns="columns" :data="value">
        <template slot-scope="{ row, index }" slot="location">
            <span>{{row.location.code}}</span>
        </template>
        <template slot-scope="{ row, index }" slot="attribute">
            <span v-if="row.attribute === 0">良品</span>
            <span v-if="row.attribute === 1">不良品</span>
        </template>
        <template slot-scope="{ row, index }" slot="expire">
            <span v-if="row.expire === 0">没到期</span>
            <span v-if="row.expire === 1">到期</span>
        </template>
    </Table>
</template>

<script>
    export default {
        name: "batchs",
        props: {
            value: {
                type: Array,
                default: () => []
            }
        },
        data() {
            return {
                columns: [{
                    title: '序号',
                    width: 80,
                    type: 'index'
                },  {
                    title: '货架号',
                    slot: 'location'
                },{
                    title: '属性',
                    slot: 'attribute'
                },{
                    title: '条码',
                    key: 'barcode'
                }, {
                    title: '数量',
                    key: 'quantity'
                }, {
                    title: '是否到期',
                    slot: 'expire'
                }, {
                    title: '批次号',
                    key: 'batch'
                },  {
                    title: '生产日期',
                    key: 'produce'
                },  {
                    title: '备注',
                    key: 'remark'
                }, {
                    title: '操作时间',
                    key: 'created_at'
                }]
            }
        }
    }
</script>

<style scoped>

</style>